package com.itboye.shopcar_adapter;

import java.util.ArrayList;

import com.itboye.jmsfhz.R;
import com.lfh.commentdemo.bean.AppModelNewsBean;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class HeZuoAdapter extends BaseAdapter {
	Context context;
	AppModelNewsBean list;
	public HeZuoAdapter(Context context,AppModelNewsBean list) {
		this.context = context;
		this.list=list;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return list.getList()==null?0:list.getList().size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		ViewHouder houder;
		if (convertView == null) {
			houder=new ViewHouder();
			convertView = LayoutInflater.from(context).inflate(
					R.layout.item_list_app, null);
			houder.tvMessge=(TextView) convertView.findViewById(R.id.tvMessge);
			houder.tvRoofTime=(TextView) convertView.findViewById(R.id.tvRoofTime);
			houder.tvcom=(TextView) convertView.findViewById(R.id.tvcom);
			convertView.setTag(houder);
		}else{
			houder=(ViewHouder) convertView.getTag();
		}
		houder.tvMessge.setText(list.getList().get(position).getNickname());
		houder.tvRoofTime.setText(list.getList().get(position).getStart_time());
		houder.tvcom.setTag(list.getList().get(position).getPost_author());
		return convertView;
	}
	class  ViewHouder{
		TextView tvMessge;
		TextView tvRoofTime;
		TextView tvcom;
	}

}
